<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Login</title>
<script type="text/javascript" src="/js/sha1.js"></script>
<script type="text/javascript"><!--
function hashit(inputvalue, targetfield) {
  targetfield.value = hex_sha1(inputvalue);
  return 1;
}

function copyit(inputvalue, targetfield) {
  targetfield.value = inputvalue;  
  return 1;
}

//--></script>
</head>
<body bgcolor="#eeeeee">

<!--
The 'scratchpad' form is used to gather data and when 'Login' is pressed then the 'login' form is submitted.
The username is copied as is on change.
The password is SHA-1 encoded on change.
-->
<p>
Login form will query the password and use SHA-1 to encode it and submit.<br/>
Redirect to SESSION variable /SESSION/user/ru = %[SESSION]{{{user/ru}}}[SESSION]%	
 if succesful which would have been set by the controller that redirected you here</p>
<br/>
Currently any username and password will work.<br/>
<br/>
NOTE: If the command is using secure redirect (default) then hostname of this URL must match the reported hostname.
Default reported hostname is the IP so the URL should use IP also otherwise the redirect cookie is set against
the hostname of this URL and after redirect the cookies used will be for the reported host and thus may be lost.
This is due to http: to https: redirect and change in hostnames; cookies are tied to the hostname despite the
fact localhost = 127.0.0.1 = your IP, but result in 3 separate cookies.  If you get redirected back to the login
page as already logged in you have a hostname mismatch.<br/>
<br/>
<form id="login" method="get" action="/user/User_Authenticate">
  <input type="hidden" name="un"/>
  <input type="hidden" name="pwd"/>
  <small><input type="checkbox" name="dumpContext" value="1"/><b>DEBUG</b>: add &amp;dumpContext=1</small><br/>
<!-- Insert original parameters -->	
%[LUA]{{{
print("<!-- original params -->");
}}}[LUA]%	
</form>
<form id="scratchpad" method="get" onsubmit="return 0;">
  <table>
    <tbody>
      <tr>
        <th>Username</th><td><input type="text" maxlength="30" onchange="javascript:copyit(this.value, login.un);"/></td>
      </tr>
      <tr>
        <th>Password</th><td><input type="password" maxlength="30" onchange="javascript:hashit(this.value, login.pwd);"/></td>
      </tr>
      <tr>
        <th colspan="2" align="right"><input type="button" value="Login" onclick="javascript:login.submit();"/></th>
      </tr>
    </tbody>
  </table>
</form>
</body>
</html>
